//
//  StarViewController.m
//  DebugDemo
//
//  Created by XFB on 2019/1/9.
//  Copyright © 2019年 ZhouCheng. All rights reserved.
//

#import "StarViewController.h"

#import "CustomStarView.h"

@interface StarViewController ()

@property (nonatomic, assign) NSInteger grade;
@property (nonatomic, strong) UILabel *gradeLabel;

@end

@implementation StarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.grade = 0;
    
    CustomStarView *starView = [[CustomStarView alloc] initWithFrame:CGRectMake(ScreenW/2-110, NavBarHeight + 60, 220, 50) normalImageName:@"my_complaint_evaluate_star_normal" selectImageName:@"my_complaint_evaluate_star_select"];
    [self.view addSubview:starView];
    
    self.gradeLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 200, ScreenW-40, 40)];
    self.gradeLabel.textColor = [UIColor orangeColor];
    self.gradeLabel.text = @"请选择星级";
    self.gradeLabel.font = [UIFont systemFontOfSize:16];
    self.gradeLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.gradeLabel];
    
    __weak typeof(self) weakSelf = self;
    starView.gradeBlock = ^(NSInteger grade, NSString * _Nonnull gradeString) {
        weakSelf.grade = grade;
        weakSelf.gradeLabel.text = [NSString stringWithFormat:@"%ld ---- %@", grade, gradeString];
    };

    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
